<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@taglib prefix="s" uri="/struts-tags" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>我的米游助手个人中心 - 应用上传</title>

<link rel="stylesheet"
	href="${pageContext.request.contextPath}/css/member/style.css"
	type="text/css"></link>
<link rel="stylesheet"
	href="${pageContext.request.contextPath}/css/member/page.css"
	type="text/css"></link>
<link rel="stylesheet"
	href="${pageContext.request.contextPath}/jslib/jquery.css"
	type="text/css"></link>
<script type="text/javascript"
	src="${pageContext.request.contextPath}/jslib/jquery-1.9.1.min.js"></script>
<script type="text/javascript"
		src="${pageContext.request.contextPath}/jslib/zsUtil.js"></script>
<script type="text/javascript"
	src="${pageContext.request.contextPath}/jslib/layer/layer.min.js"></script>
<link rel="stylesheet"
	href="${pageContext.request.contextPath}/jslib/Validform/Validform_v5.3.2_css.css"
	type="text/css"></link>
<script type="text/javascript"
	src="${pageContext.request.contextPath}/jslib/Validform/Validform_v5.3.2_min.js"></script>
</head>

<body>
	<div id="doc-hd">
	
	</div>
	<div class="top_nav">
		<div class="navbar">
			<ul>
				<li><a
					href="${pageContext.request.contextPath}/pages/member/main.jsp"
					target="_parent">首 页</a></li>
				<li id="personinfo"><a
					href="${pageContext.request.contextPath}/system/userinfo.shtml"
					target="_parent">帐号资料</a></li>
				<li class="cur"><a
					href="${pageContext.request.contextPath}/system/appinfo.shtml"
					target="_parent">应用上传</a></li>
				<li><a
					href="${pageContext.request.contextPath}/pages/member/main.jsp"
					target="_parent">帐号安全</a></li>
				<li><a
					href="${pageContext.request.contextPath}/pages/member/main.jsp"
					target="_parent">我的特权</a></li>
			</ul>
		</div>
	</div>
	<div id="doc-bd">
		<form id="appForm" method="post"> 
		<input type="hidden" name="appsoft.id">
		<input type="hidden" name="appsoft.userid">
		<input type="hidden" name="appsoft.softversion">
		<input type="hidden" name="appsoft.softsize">
		<input type="hidden" name="appsoft.createdate">
		<input type="hidden" name="appsoft.updatedate">
		<input type="hidden" name="appsoft.addeddate">
		<input type="hidden" name="appsoft.auditname">
		<input type="hidden" name="appsoft.auditdate">
		<input type="hidden" name="appsoft.auditidea">
		<input type="hidden" name="appsoft.audittype">
		<table border="0" width="100%">
		<tr>
			<td width="15%"></td>
			<td width="70%">
				<table border="0" width="100%">
					<tr>
						<td colspan="1">
							<h2>添加应用</h2>
						</td>
						<td align="right" valign="top">*必填信息</td>
						
					</tr>		
					<tr>
						<td colspan="3">
							<hr>
							<h3>安装包</h3>
							<hr>
						</td>
					</tr>
					<tr height="35px">
						<td width="30%" align="right">安装包*</td>
						<td>
							<input type="hidden" name="appsoft.productguid" value="${productguid}">
							<span id="product_content" style="color:blue"></span>
							<input type="button" value="上传" id="anzhuangbao">
						</td>
						<td></td>
					</tr>
					<tr>
						<td width="30%" align="right" valign="top">付费形式*</td>
						<td>
							<input type="radio" checked="true" name="appsoft.paytype" value="000">无任何付费内容<br>
							<input type="radio" name="appsoft.paytype" value="001">付费购买道具、表情等虚拟物品<br>
							<input type="radio" name="appsoft.paytype" value="002">付费购买完整版应用<br>
						</td>
						<td></td>
					</tr>
					<tr height="40px">
						<td width="30%" align="right"></td>
						<td valign="bottom">如应用中包含付费项目，必须提醒用户二次确认方可扣费，否则将审核不通过</td>
						<td></td>
					</tr>
					<tr>
						<td width="30%" align="right" valign="top">升级日志*</td>
						<td>
							<textarea rows="5" cols="50" name="appsoft.updatescript"></textarea><br>
							500字以内
						</td>
						<td></td>
					</tr>					
					<tr>
						<td colspan="3">
							<br>			
							<h3>基本信息</h3>
							<hr>
						</td>
					</tr>
					<tr>
						<td width="30%" align="right">应用名称*</td>
						<td>
							<input type="text" name="appsoft.softname">
						</td>
						<td></td>
					</tr>
					<tr>
						<td width="30%" align="right"></td>
						<td>
							应用原始开发团队的名称，如果您是软件代理发行商请填写该软件开发商的名称
						</td>
						<td></td>
					</tr>
					<tr>
						<td width="30%" align="right">开发者*</td>
						<td>
							<input type="text" name="appsoft.devname">
						</td>
						<td></td>
					</tr>
					<tr>
						<td width="30%" align="right">应用分类*</td>
						<td>
							<select name="appsoft.softtype">
								<option>请选择分类</option>
							</select>
						</td>
						<td></td>
					</tr>
					<tr>
						<td width="30%" align="right" valign="top">应用简介*</td>
						<td>
							<input type="text" name="appsoft.appsummary" 
								datatype="*1-10"><br>
							10字以内,解释概述应用的简介或slogan,其将作为副标题呈现给用户
						</td>
						<td>
									
						</td>
					</tr>	
					<tr>
						<td width="30%" align="right" valign="top">应用描述*</td>
						<td>
							<textarea rows="5" cols="50" name="appsoft.appscript"></textarea><br>
							500字以内
						</td>
						<td></td>
					</tr>	
					<tr>
						<td colspan="3">
							<br>			
							<h3>图片素材</h3>
							<hr>
						</td>
					</tr>		
					<tr height="35px">
						<td width="30%" align="right" valign="top">图标*</td>
						<td>
							<input type="hidden" name="appsoft.icoguid">
							<input type="button" value="上传图标">
							<br>请上传512*512大小的高分辩率图标
						</td>
						<td></td>
					</tr>
					<tr height="35px">
						<td width="30%" align="right" valign="top">应用封面</td>
						<td>
							<input type="hidden" name="appsoft.coverguid">
							<input type="button" value="上传封面">
							<br>合作推广应用请上传(480*240)
						</td>
						<td></td>
					</tr>
					<tr height="35px">
						<td width="30%" align="right" valign="top">应用截图*</td>
						<td>
							<input type="hidden" name="appsoft.screenguid">
							<input type="button" value="上传截图">
							<br>请至少上传4张截图
						</td>
						<td></td>
					</tr>
					<tr>
						<td colspan="3">
							<br>			
							<h3>应用资质</h3>
							<hr>
						</td>
					</tr>		
					<tr height="35px">
						<td width="30%" align="right" valign="top">资质证明*</td>
						<td>
							<input type="hidden" name="appsoft.qualguid"> 
							<input type="button" value="上传">
							<br>公司请上传软件著作权，或开发者权利声明，或代理资质证明，个人请上传开发者权利声明，均分扫描件
						</td>
						<td></td>
					</tr>
					<tr height="35px">
						<td width="30%" align="right" valign="top"></td>
						<td>
							<input type="button" value="保存">
							<input type="button" value="取消">
						</td>
						<td></td>
					</tr>
				</table>
			</td>			
			<td width="15%">t</td>
		</tr>
	</table>
	</form>
	</div>
	<!-- 尾页 -->
	<jsp:include page="/pages/member/footer.jsp" flush="true"></jsp:include>
</body>
<script type="text/javascript" charset="utf-8">
	$(function() {
		//表单验证
		$('#appForm').Validform({			
			tiptype:function(msg,o,cssctl){
				//msg：提示信息;
				//o:{obj:*,type:*,curform:*}, obj指向的是当前验证的表单元素（或表单对象），type指示提示的状态，值为1、2、3、4， 1：正在检测/提交数据，2：通过验证，3：验证失败，4：提示ignore状态, curform为当前form对象;
				//cssctl:内置的提示信息样式控制函数，该函数需传入两个参数：显示提示信息的对象 和 当前提示的状态（既形参o中的type）;
				if(!o.obj.is("form")){//验证表单元素时o.obj为该表单元素，全部验证通过提交表单时o.obj为该表单对象;
					var objtip=o.obj.siblings(".Validform_checktip");
					cssctl(objtip,o.type);
					objtip.text(msg);
				}
			}
			
		});		
		
		
		//保存
		$('#saveUser').click(function(){
			$.ajax({
			   type: "POST",
			   url: "${pageContext.request.contextPath}/system/saveAppsoft.shtml",
			   data: $('#userForm').serializeArray(),
			   success: function(msg){
			     	new $.msgbox({
						autoClose: 3,
						height:50,
						width:200,
						title: '提示',						
						content:'保存成功',
						type :'text',
						onClose: function(){							
							 location.reload(); 
						} 
					}).show();  
			   }
			});
			
		});
		
		//安装包上传
		$('#anzhuangbao').click(function(){		
			var linkguid =	$("input[name='productguid']").val();
			var devuid = '${session.CURUSER.devuid}';
			$.layer({
			    type : 2,
			    title : '附件',
			    iframe : {src : '${pageContext.request.contextPath}/system/getAttachConfigure.shtml?uploadType=000&linkguid=' + linkguid + '&devuid=' + devuid},
			    area : ['550px' , '400px'],
			    offset : ['100px',''],
			    close : function(index){
			    	layer.close(index);
			    	//获取附件信息
					$.ajax({
					   type: "POST",
					   url: "${pageContext.request.contextPath}/system/getAttachInfo.shtml",
					   data: {'linkguid': linkguid},
					   dataType: 'json',
					   success: function(msg){					   		
					   		if(msg == null || (msg != null && msg.id == null)){					   			
					   			$('#product_content').html('');
					   		}else{
					   			$('#product_content').html(msg.productname);
					   		}	
					   }
					});
				}
			});		 	
		});
		
		//初始化值 
		initform();
		
		
	});
	
	//初始化值 
	function initform(){
		var productguid = $("input[name='appsoft.productguid']").val();
		if(productguid== null || productguid ==""){
			productguid.val(newGuid());
		}
		var icoguid = $("input[name='appsoft.icoguid']").val();
		if(icoguid== null || icoguid ==""){
			icoguid.val(newGuid());
		}
		var coverguid = $("input[name='appsoft.coverguid']").val();
		if(coverguid== null || coverguid ==""){
			coverguid.val(newGuid());
		}
		var screenguid = $("input[name='appsoft.screenguid']").val();
		if(screenguid== null || screenguid ==""){
			screenguid.val(newGuid());
		}
		var qualguid = $("input[name='appsoft.qualguid']").val();
		if(qualguid== null || qualguid ==""){
			qualguid.val(newGuid());
		}
	}
</script>
</html>
